/*
package com.htht.job.executor.util.downLoad;

import org.apache.commons.io.IOUtils;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPCmd;
import org.apache.commons.net.ftp.FTPFile;

import java.io.*;
import java.net.Socket;

*/
/**
 * Created by zzj on 2018/1/8.
 *//*

public class FTPClientUtil extends   FTPClient{


   public void aa(){
       try {
           this.connect("10.37.129.5",21);
           this.login("zzj","root");
       } catch (IOException e) {
           throw new RuntimeException();
       }
   }
    public boolean listFilenameToLocalFile(File local) throws IOException {
        return listFilenameToLocalFile(null, local);
    }

    public boolean listFilenameToLocalFile(String remote, File local) throws IOException {
        if (null != remote) {
            boolean chRes = changeWorkingDirectory("/home/zzj/Desktop/zk");
            if (!chRes) {
                return false;
            }

        }
        FTPFile[] fs = listFiles();

        // 获取发送NLST命令时建立的Socket连接
        Socket socket = _openDataConnection_(FTPCmd.NLST.getCommand(), null);

        if (socket == null) {
            return false;
        }
        // 获取Socket输入流
        InputStream is = socket.getInputStream();

        try {
            // 写出到本地文件
            return writeToFile(is, local);
        } catch (Exception e) {
            throw new RuntimeException();
        } finally {
            IOUtils.closeQuietly(is);
            IOUtils.closeQuietly(socket);
        }
        return false;
    }

    private boolean writeToFile(InputStream is, File local) {
        BufferedWriter bw = null;
        BufferedReader br = null;

        String line;
        try {
            bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(local)));
            br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
            while((line = br.readLine()) != null) {
                bw.write(line);
                bw.newLine();
            }
            bw.flush();
            return true;
        } catch (IOException e) {
            return false;
        } finally {
            IOUtils.closeQuietly(bw);
            IOUtils.closeQuietly(br);
        }
    }

    public  static  void main(String[] args){
       FTPClientUtil a=new FTPClientUtil();
       File file=new File("/zzj/a.txt");
       a.aa();
        try {
            a.listFilenameToLocalFile("",file);
        } catch (IOException e) {
            throw new RuntimeException();
        }
    }

}
*/
